home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 14155 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  40 lines

  1. Newsgroups: comp.lang.c
  2. Path: netcom.com!smryan
  3. From: smryan@netcom.com (@#$%!?!)
  4. Subject: Re: Can anyone help a newbie out ?
  5. Message-ID: <smryanDpqHp2.K3t@netcom.com>
  6. Organization: The Programmer formerly known as S M Ryan
  7. X-Newsreader: TIN [version 1.2 PL1]
  8. References: <4kkf3r$5b0@darwin.nbnet.nb.ca>
  9. Date: Fri, 12 Apr 1996 05:24:38 GMT
  10. Sender: smryan@netcom9.netcom.com
  11.  
  12. : char checksize(char x[], char y[])
  13. : {
  14. :     int count, int total = 0, int total1 = 0;
  15.  
  16. :     while (*x != NULL)
  17. :         total += 1
  18.  
  19. :     while (*y != NULL)
  20. :         total1 += 1
  21.  
  22. (1) the variables in the while predicates are loop invariant. The loops
  23. will either execute zero or infinite number of times.
  24.  
  25. (2) if you modify x or y, then you must correct the reference to them
  26. in the following statements.
  27.  
  28. :     
  29. :     if (total < total2)
  30. :         return *y;
  31. :     if (total > total2)
  32. :         return *x;
  33.  
  34. (3) You are returning a character not a character pointer.
  35. -- 
  36. The Queen, amused, in quiet power,         | smryan@netcom.com  PO Box 1563
  37. will draw the son to darkenned bower.      |          Cupertino, California
  38. Her face is fair, her fragrance rare,      | (xxx)xxx-xxxx            95015
  39. with woven webs for wayward flower.        |         I don't use no smileys
  40.